package com.cncytech.uiautomator_demo.testcase;

import com.cncytech.uiautomator_demo.BaseTest;
import com.cncytech.uiautomator_demo.TestConstant;
import com.cncytech.uiautomator_demo.RetryWatcher;
import com.cncytech.uiautomator_demo.utils.Describe;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import org.junit.Rule;
import org.junit.Test;

public class ExternalStoragePoliciesTest extends BaseTest {
    @Rule
    public RetryWatcher retryWatcher = new RetryWatcher(TestConstant.retryCount);


    @Test
    @Describe(TestConstant.EXTERNALSTORAGE_FORBIDDEN)
    public void ExternalStorageForbiddenTest() {
        String msg = TestConstant.EXTERNALSTORAGE_FORBIDDEN + TestConstant.FAILURE;
        int status = 0;
        assertThat(msg, hmm.setExternalStoragePolicies(status));
        int externalStoragePolicies = hmm.getExternalStoragePolicies();
        assertThat(msg, externalStoragePolicies, is(status));
    }
    @Test
    @Describe(TestConstant.EXTERNALSTORAGE_ONLYREAD)
    public void ExternalStorageOnlyReadTest() {
        String msg = TestConstant.EXTERNALSTORAGE_ENABLE + TestConstant.FAILURE;
        int status = 1;
        assertThat(msg, hmm.setExternalStoragePolicies(status));
        int externalStoragePolicies = hmm.getExternalStoragePolicies();
        assertThat(msg, externalStoragePolicies, is(status));
    }
    @Test
    @Describe(TestConstant.EXTERNALSTORAGE_ENABLE)
    public void ExternalStorageEnableTest() {
        String msg = TestConstant.EXTERNALSTORAGE_ENABLE + TestConstant.FAILURE;
        int status = 2;
        assertThat(msg, hmm.setExternalStoragePolicies(status));
        int externalStoragePolicies = hmm.getExternalStoragePolicies();
        assertThat(msg, externalStoragePolicies, is(status));
    }
}
